﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net.Sockets;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using HslCommunication.BasicFramework;
using HslCommunication.Core;
using HslCommunication.Core.IMessage;
using HslCommunication.Core.Net;
using HslCommunication.Profinet.AllenBradley;
using HslCommunication.Reflection;

namespace HslCommunication.Profinet.Omron
{
	/// <summary>
	/// 基于连接的对象访问的CIP协议的实现，用于对Omron PLC进行标签的数据读写，对数组，多维数组进行读写操作，支持的数据类型请参照API文档手册。<br />
	/// The implementation of the CIP protocol based on connected object access is used to read and write tag data to Omron PLC, 
	/// and read and write arrays and multidimensional arrays. For the supported data types, please refer to the API documentation manual.
	/// </summary>
	/// <remarks>
	/// 支持普通标签的读写，类型要和标签对应上。如果标签是数组，例如 A 是 INT[0...9] 那么Read("A", 1)，返回的是10个short所有字节数组。
	/// 如果需要返回10个长度的short数组，请调用 ReadInt16("A[0], 10"); 地址必须写 "A[0]"，不能写 "A" , 如需要读取结构体，参考 <see cref="M:HslCommunication.Profinet.Omron.OmronConnectedCipNet.ReadStruct``1(System.String)" />
	/// </remarks>
	/// <example>
	/// 首先说明支持的类型地址，在PLC里支持了大量的类型，有些甚至在C#里是不存在的。现在做个统一的声明
	/// <list type="table">
	///   <listheader>
	///     <term>PLC类型</term>
	///     <term>含义</term>
	///     <term>代号</term>
	///     <term>C# 类型</term>
	///     <term>备注</term>
	///   </listheader>
	///   <item>
	///     <term>bool</term>
	///     <term>位类型数据</term>
	///     <term>0xC1</term>
	///     <term>bool</term>
	///     <term></term>
	///   </item>
	///   <item>
	///     <term>SINT</term>
	///     <term>8位的整型</term>
	///     <term>0xC2</term>
	///     <term>sbyte</term>
	///     <term>有符号8位很少用，HSL直接用byte</term>
	///   </item>
	///   <item>
	///     <term>USINT</term>
	///     <term>无符号8位的整型</term>
	///     <term>0xC6</term>
	///     <term>byte</term>
	///     <term>如需要，使用<see cref="M:HslCommunication.Profinet.Omron.OmronConnectedCipNet.WriteTag(System.String,System.UInt16,System.Byte[],System.Int32)" />实现</term>
	///   </item>
	///   <item>
	///     <term>BYTE</term>
	///     <term>8位字符数据</term>
	///     <term>0xD1</term>
	///     <term>byte</term>
	///     <term>如需要，使用<see cref="M:HslCommunication.Profinet.Omron.OmronConnectedCipNet.WriteTag(System.String,System.UInt16,System.Byte[],System.Int32)" />实现</term>
	///   </item>
	///   <item>
	///     <term>INT</term>
	///     <term>16位的整型</term>
	///     <term>0xC3</term>
	///     <term>short</term>
	///     <term></term>
	///   </item>
	///   <item>
	///     <term>UINT</term>
	///     <term>无符号的16位整型</term>
	///     <term>0xC7</term>
	///     <term>ushort</term>
	///     <term></term>
	///   </item>
	///   <item>
	///     <term>DINT</term>
	///     <term>32位的整型</term>
	///     <term>0xC4</term>
	///     <term>int</term>
	///     <term></term>
	///   </item>
	///   <item>
	///     <term>UDINT</term>
	///     <term>无符号的32位整型</term>
	///     <term>0xC8</term>
	///     <term>uint</term>
	///     <term></term>
	///   </item>
	///   <item>
	///     <term>LINT</term>
	///     <term>64位的整型</term>
	///     <term>0xC5</term>
	///     <term>long</term>
	///     <term></term>
	///   </item>
	///   <item>
	///     <term>ULINT</term>
	///     <term>无符号的64位的整型</term>
	///     <term>0xC9</term>
	///     <term>ulong</term>
	///     <term></term>
	///   </item>
	///   <item>
	///     <term>REAL</term>
	///     <term>单精度浮点数</term>
	///     <term>0xCA</term>
	///     <term>float</term>
	///     <term></term>
	///   </item>
	///   <item>
	///     <term>DOUBLE</term>
	///     <term>双精度浮点数</term>
	///     <term>0xCB</term>
	///     <term>double</term>
	///     <term></term>
	///   </item>
	///   <item>
	///     <term>STRING</term>
	///     <term>字符串数据</term>
	///     <term>0xD0</term>
	///     <term>string</term>
	///     <term>前两个字节为字符长度</term>
	///   </item>
	///   <item>
	///     <term>8bit string BYTE</term>
	///     <term>8位的字符串</term>
	///     <term>0xD1</term>
	///     <term></term>
	///     <term>本质是BYTE数组</term>
	///   </item>
	///   <item>
	///     <term>16bit string WORD</term>
	///     <term>16位的字符串</term>
	///     <term>0xD2</term>
	///     <term></term>
	///     <term>本质是WORD数组，可存放中文</term>
	///   </item>
	///   <item>
	///     <term>32bit string DWORD</term>
	///     <term>32位的字符串</term>
	///     <term>0xD2</term>
	///     <term></term>
	///     <term>本质是DWORD数组，可存放中文</term>
	///   </item>
	/// </list>
	/// 在读写操作之前，先看看怎么实例化和连接PLC<br />
	/// <code lang="cs" source="HslCommunication_Net45.Test\Documentation\Samples\Profinet\OmronConnectedCipNetSample.cs" region="Usage" title="实例化及连接示例" />
	/// 现在来说明以下具体的操作细节。我们假设有如下的变量：<br />
	/// CESHI_A       SINT<br />
	/// CESHI_B       BYTE<br />
	/// CESHI_C       INT<br />
	/// CESHI_D       UINT<br />
	/// CESHI_E       SINT[0..9]<br />
	/// CESHI_F       BYTE[0..9]<br />
	/// CESHI_G       INT[0..9]<br />
	/// CESHI_H       UINT[0..9]<br />
	/// CESHI_I       INT[0..511]<br />
	/// CESHI_J       STRING[12]<br />
	/// ToPc_ID1      ARRAY[0..99] OF STRING[20]<br />
	/// CESHI_O       BOOL<br />
	/// CESHI_P       BOOL[0..31]<br />
	/// 对 CESHI_A 来说，读写这么操作
	/// <code lang="cs" source="HslCommunication_Net45.Test\Documentation\Samples\Profinet\OmronConnectedCipNetSample.cs" region="Usage2" title="读写示例" />
	/// 对于 CESHI_B 来说，写入的操作有点特殊
	/// <code lang="cs" source="HslCommunication_Net45.Test\Documentation\Samples\Profinet\OmronConnectedCipNetSample.cs" region="Usage3" title="读写示例" />
	/// 对于 CESHI_C, CESHI_D 来说，就是 ReadInt16(string address) , Write( string address, short value ) 和 ReadUInt16(string address) 和 Write( string address, ushort value ) 差别不大。
	/// 所以我们着重来看看数组的情况，以 CESHI_G 标签为例子:<br />
	/// 情况一，我想一次读取这个标签所有的字节数组（当长度满足的情况下，会一次性返回数据）
	/// <code lang="cs" source="HslCommunication_Net45.Test\Documentation\Samples\Profinet\OmronConnectedCipNetSample.cs" region="Usage4" title="读写示例" />
	/// 情况二，我想读取第3个数，或是第6个数开始，一共5个数
	/// <code lang="cs" source="HslCommunication_Net45.Test\Documentation\Samples\Profinet\OmronConnectedCipNetSample.cs" region="Usage5" title="读写示例" />
	/// 其他的数组情况都是类似的，我们来看看字符串 CESHI_J 变量
	/// <code lang="cs" source="HslCommunication_Net45.Test\Documentation\Samples\Profinet\OmronConnectedCipNetSample.cs" region="Usage6" title="读写示例" />
	/// 对于 bool 变量来说，就是 ReadBool("CESHI_O") 和 Write("CESHI_O", true) 操作，如果是bool数组，就不一样了
	/// <code lang="cs" source="HslCommunication_Net45.Test\Documentation\Samples\Profinet\OmronConnectedCipNetSample.cs" region="Usage7" title="读写示例" />
	/// 最后我们来看看结构体的操作，假设我们有个结构体<br />
	/// MyData.Code     STRING(12)<br />
	/// MyData.Value1   INT<br />
	/// MyData.Value2   INT<br />
	/// MyData.Value3   REAL<br />
	/// MyData.Value4   INT<br />
	/// MyData.Value5   INT<br />
	/// MyData.Value6   INT[0..3]<br />
	/// 因为bool比较复杂，暂时不考虑。要读取上述的结构体，我们需要定义结构一样的数据
	/// <code lang="cs" source="HslCommunication_Net45.Test\Documentation\Samples\Profinet\OmronConnectedCipNetSample.cs" region="Usage8" title="结构体" />
	/// 定义好后，我们再来读取就很简单了。
	/// <code lang="cs" source="HslCommunication_Net45.Test\Documentation\Samples\Profinet\OmronConnectedCipNetSample.cs" region="Usage9" title="读写示例" />
	/// </example>
	// Token: 0x02000058 RID: 88
	public class OmronConnectedCipNet : NetworkDeviceBase
	{
		/// <summary>
		/// 实例化一个默认的对象
		/// </summary>
		// Token: 0x06000719 RID: 1817 RVA: 0x00025624 File Offset: 0x00023824
		public OmronConnectedCipNet()
		{
			base.WordLength = 2;
			base.ByteTransform = new RegularByteTransform();
		}

		/// <summary>
		/// 根据指定的IP及端口来实例化这个连接对象
		/// </summary>
		/// <param name="ipAddress">PLC的Ip地址</param>
		/// <param name="port">PLC的端口号信息</param>
		// Token: 0x0600071A RID: 1818 RVA: 0x00025674 File Offset: 0x00023874
		public OmronConnectedCipNet(string ipAddress, int port = 44818)
		{
			this.IpAddress = ipAddress;
			this.Port = port;
			base.WordLength = 2;
			base.ByteTransform = new RegularByteTransform();
		}

		/// <inheritdoc />
		// Token: 0x0600071B RID: 1819 RVA: 0x000256D3 File Offset: 0x000238D3
		protected override INetMessage GetNewNetMessage()
		{
			return new AllenBradleyMessage();
		}

		/// <inheritdoc />
		// Token: 0x0600071C RID: 1820 RVA: 0x000256DC File Offset: 0x000238DC
		protected override byte[] PackCommandWithHeader(byte[] command)
		{
			return AllenBradleyHelper.PackRequestHeader(112, this.SessionHandle, AllenBradleyHelper.PackCommandSpecificData(new byte[][]
			{
				this.GetOTConnectionIdService(),
				command
			}));
		}

		/// <inheritdoc />
		// Token: 0x0600071D RID: 1821 RVA: 0x00025714 File Offset: 0x00023914
		protected override OperateResult InitializationOnConnect(Socket socket)
		{
			OperateResult<byte[]> operateResult = this.ReadFromCoreServer(socket, AllenBradleyHelper.RegisterSessionHandle(), true, false);
			bool flag = !operateResult.IsSuccess;
			OperateResult result;
			if (flag)
			{
				result = operateResult;
			}
			else
			{
				OperateResult operateResult2 = AllenBradleyHelper.CheckResponse(operateResult.Content);
				bool flag2 = !operateResult2.IsSuccess;
				if (flag2)
				{
					result = operateResult2;
				}
				else
				{
					this.SessionHandle = base.ByteTransform.TransUInt32(operateResult.Content, 4);
					OperateResult<byte[]> operateResult3 = this.ReadFromCoreServer(socket, AllenBradleyHelper.PackRequestHeader(111, this.SessionHandle, this.GetLargeForwardOpen()), true, false);
					bool flag3 = !operateResult3.IsSuccess;
					if (flag3)
					{
						result = operateResult3;
					}
					else
					{
						bool flag4 = operateResult3.Content[42] > 0;
						if (flag4)
						{
							bool flag5 = base.ByteTransform.TransUInt16(operateResult3.Content, 44) == 256;
							if (flag5)
							{
								result = new OperateResult("Connection in use or duplicate Forward Open");
							}
							else
							{
								result = new OperateResult("Forward Open failed, Code: " + base.ByteTransform.TransUInt16(operateResult3.Content, 44).ToString());
							}
						}
						else
						{
							this.OTConnectionId = base.ByteTransform.TransUInt32(operateResult3.Content, 44);
							this.incrementCount.ResetCurrentValue();
							OperateResult<byte[]> operateResult4 = this.ReadFromCoreServer(socket, AllenBradleyHelper.PackRequestHeader(111, this.SessionHandle, this.GetAttributeAll()), true, false);
							bool flag6 = !operateResult4.IsSuccess;
							if (flag6)
							{
								result = operateResult4;
							}
							else
							{
								bool flag7 = operateResult4.Content.Length > 59;
								if (flag7)
								{
									this.ProductName = Encoding.UTF8.GetString(operateResult4.Content, 59, (int)operateResult4.Content[58]);
								}
								result = OperateResult.CreateSuccessResult();
							}
						}
					}
				}
			}
			return result;
		}

		/// <inheritdoc />
		// Token: 0x0600071E RID: 1822 RVA: 0x000258C4 File Offset: 0x00023AC4
		protected override OperateResult ExtraOnDisconnect(Socket socket)
		{
			OperateResult<byte[]> operateResult = this.ReadFromCoreServer(socket, AllenBradleyHelper.UnRegisterSessionHandle(this.SessionHandle), true, false);
			bool flag = !operateResult.IsSuccess;
			OperateResult result;
			if (flag)
			{
				result = operateResult;
			}
			else
			{
				result = OperateResult.CreateSuccessResult();
			}
			return result;
		}

		/// <inheritdoc />
		// Token: 0x0600071F RID: 1823 RVA: 0x00025904 File Offset: 0x00023B04
		[DebuggerStepThrough]
		protected override Task<OperateResult> InitializationOnConnectAsync(Socket socket)
		{
			OmronConnectedCipNet.<InitializationOnConnectAsync>d__6 <InitializationOnConnectAsync>d__ = new OmronConnectedCipNet.<InitializationOnConnectAsync>d__6();
			<InitializationOnConnectAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<InitializationOnConnectAsync>d__.<>4__this = this;
			<InitializationOnConnectAsync>d__.socket = socket;
			<InitializationOnConnectAsync>d__.<>1__state = -1;
			<InitializationOnConnectAsync>d__.<>t__builder.Start<OmronConnectedCipNet.<InitializationOnConnectAsync>d__6>(ref <InitializationOnConnectAsync>d__);
			return <InitializationOnConnectAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc />
		// Token: 0x06000720 RID: 1824 RVA: 0x00025950 File Offset: 0x00023B50
		[DebuggerStepThrough]
		protected override Task<OperateResult> ExtraOnDisconnectAsync(Socket socket)
		{
			OmronConnectedCipNet.<ExtraOnDisconnectAsync>d__7 <ExtraOnDisconnectAsync>d__ = new OmronConnectedCipNet.<ExtraOnDisconnectAsync>d__7();
			<ExtraOnDisconnectAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<ExtraOnDisconnectAsync>d__.<>4__this = this;
			<ExtraOnDisconnectAsync>d__.socket = socket;
			<ExtraOnDisconnectAsync>d__.<>1__state = -1;
			<ExtraOnDisconnectAsync>d__.<>t__builder.Start<OmronConnectedCipNet.<ExtraOnDisconnectAsync>d__7>(ref <ExtraOnDisconnectAsync>d__);
			return <ExtraOnDisconnectAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="P:HslCommunication.Profinet.AllenBradley.AllenBradleyNet.SessionHandle" />
		// Token: 0x1700014D RID: 333
		// (get) Token: 0x06000721 RID: 1825 RVA: 0x0002599B File Offset: 0x00023B9B
		// (set) Token: 0x06000722 RID: 1826 RVA: 0x000259A3 File Offset: 0x00023BA3
		public uint SessionHandle { get; protected set; }

		/// <summary>
		/// 当前产品的型号信息<br />
		/// Model information of the current product
		/// </summary>
		// Token: 0x1700014E RID: 334
		// (get) Token: 0x06000723 RID: 1827 RVA: 0x000259AC File Offset: 0x00023BAC
		// (set) Token: 0x06000724 RID: 1828 RVA: 0x000259B4 File Offset: 0x00023BB4
		public string ProductName { get; private set; }

		// Token: 0x06000725 RID: 1829 RVA: 0x000259C0 File Offset: 0x00023BC0
		private byte[] GetOTConnectionIdService()
		{
			byte[] array = new byte[8];
			array[0] = 161;
			array[1] = 0;
			array[2] = 4;
			array[3] = 0;
			base.ByteTransform.TransByte(this.OTConnectionId).CopyTo(array, 4);
			return array;
		}

		// Token: 0x06000726 RID: 1830 RVA: 0x00025A08 File Offset: 0x00023C08
		private OperateResult<byte[]> BuildReadCommand(string[] address, ushort[] length)
		{
			OperateResult<byte[]> result;
			try
			{
				List<byte[]> list = new List<byte[]>();
				for (int i = 0; i < address.Length; i++)
				{
					list.Add(AllenBradleyHelper.PackRequsetRead(address[i], (int)length[i], true));
				}
				result = OperateResult.CreateSuccessResult<byte[]>(this.PackCommandService(list.ToArray()));
			}
			catch (Exception ex)
			{
				result = new OperateResult<byte[]>("Address Wrong:" + ex.Message);
			}
			return result;
		}

		// Token: 0x06000727 RID: 1831 RVA: 0x00025A88 File Offset: 0x00023C88
		private OperateResult<byte[]> BuildWriteCommand(string address, ushort typeCode, byte[] data, int length = 1)
		{
			OperateResult<byte[]> result;
			try
			{
				result = OperateResult.CreateSuccessResult<byte[]>(this.PackCommandService(new byte[][]
				{
					AllenBradleyHelper.PackRequestWrite(address, typeCode, data, length, true)
				}));
			}
			catch (Exception ex)
			{
				result = new OperateResult<byte[]>("Address Wrong:" + ex.Message);
			}
			return result;
		}

		// Token: 0x06000728 RID: 1832 RVA: 0x00025AE4 File Offset: 0x00023CE4
		private byte[] PackCommandService(params byte[][] cip)
		{
			MemoryStream memoryStream = new MemoryStream();
			memoryStream.WriteByte(177);
			memoryStream.WriteByte(0);
			memoryStream.WriteByte(0);
			memoryStream.WriteByte(0);
			long currentValue = this.incrementCount.GetCurrentValue();
			memoryStream.WriteByte(BitConverter.GetBytes(currentValue)[0]);
			memoryStream.WriteByte(BitConverter.GetBytes(currentValue)[1]);
			bool flag = cip.Length == 1;
			if (flag)
			{
				memoryStream.Write(cip[0], 0, cip[0].Length);
			}
			else
			{
				memoryStream.Write(new byte[]
				{
					10,
					2,
					32,
					2,
					36,
					1
				}, 0, 6);
				memoryStream.WriteByte(BitConverter.GetBytes(cip.Length)[0]);
				memoryStream.WriteByte(BitConverter.GetBytes(cip.Length)[1]);
				int num = 2 + cip.Length * 2;
				for (int i = 0; i < cip.Length; i++)
				{
					memoryStream.WriteByte(BitConverter.GetBytes(num)[0]);
					memoryStream.WriteByte(BitConverter.GetBytes(num)[1]);
					num += cip[i].Length;
				}
				for (int j = 0; j < cip.Length; j++)
				{
					memoryStream.Write(cip[j], 0, cip[j].Length);
				}
			}
			byte[] array = memoryStream.ToArray();
			memoryStream.Dispose();
			BitConverter.GetBytes((ushort)(array.Length - 4)).CopyTo(array, 2);
			return array;
		}

		// Token: 0x06000729 RID: 1833 RVA: 0x00025C48 File Offset: 0x00023E48
		private OperateResult<byte[], ushort, bool> ReadWithType(string[] address, ushort[] length)
		{
			OperateResult<byte[]> operateResult = this.BuildReadCommand(address, length);
			bool flag = !operateResult.IsSuccess;
			OperateResult<byte[], ushort, bool> result;
			if (flag)
			{
				result = OperateResult.CreateFailedResult<byte[], ushort, bool>(operateResult);
			}
			else
			{
				OperateResult<byte[]> operateResult2 = base.ReadFromCoreServer(operateResult.Content);
				bool flag2 = !operateResult2.IsSuccess;
				if (flag2)
				{
					result = OperateResult.CreateFailedResult<byte[], ushort, bool>(operateResult2);
				}
				else
				{
					OperateResult operateResult3 = AllenBradleyHelper.CheckResponse(operateResult2.Content);
					bool flag3 = !operateResult3.IsSuccess;
					if (flag3)
					{
						result = OperateResult.CreateFailedResult<byte[], ushort, bool>(operateResult3);
					}
					else
					{
						result = OmronConnectedCipNet.ExtractActualData(operateResult2.Content, true);
					}
				}
			}
			return result;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.AllenBradley.AllenBradleyNet.ReadCipFromServer(System.Byte[][])" />
		// Token: 0x0600072A RID: 1834 RVA: 0x00025CD8 File Offset: 0x00023ED8
		public OperateResult<byte[]> ReadCipFromServer(params byte[][] cips)
		{
			byte[] send = this.PackCommandService(Enumerable.ToArray<byte[]>(cips));
			OperateResult<byte[]> operateResult = base.ReadFromCoreServer(send);
			bool flag = !operateResult.IsSuccess;
			OperateResult<byte[]> result;
			if (flag)
			{
				result = operateResult;
			}
			else
			{
				OperateResult operateResult2 = AllenBradleyHelper.CheckResponse(operateResult.Content);
				bool flag2 = !operateResult2.IsSuccess;
				if (flag2)
				{
					result = OperateResult.CreateFailedResult<byte[]>(operateResult2);
				}
				else
				{
					result = OperateResult.CreateSuccessResult<byte[]>(operateResult.Content);
				}
			}
			return result;
		}

		/// <summary>
		/// <b>[商业授权]</b> 读取一个结构体的对象，需要事先根据实际的数据点位定义好结构体，然后使用本方法进行读取，当结构体定义不对时，本方法将会读取失败<br />
		/// <b>[Authorization]</b> To read a structure object, you need to define the structure in advance according to the actual data points, 
		/// and then use this method to read. When the structure definition is incorrect, this method will fail to read
		/// </summary>
		/// <remarks>
		/// 本方法需要商业授权支持，具体的使用方法，参考API文档的示例代码
		/// </remarks>
		/// <example>
		/// 我们来看看结构体的操作，假设我们有个结构体<br />
		/// MyData.Code     STRING(12)<br />
		/// MyData.Value1   INT<br />
		/// MyData.Value2   INT<br />
		/// MyData.Value3   REAL<br />
		/// MyData.Value4   INT<br />
		/// MyData.Value5   INT<br />
		/// MyData.Value6   INT[0..3]<br />
		/// 因为bool比较复杂，暂时不考虑。要读取上述的结构体，我们需要定义结构一样的数据
		/// <code lang="cs" source="HslCommunication_Net45.Test\Documentation\Samples\Profinet\OmronConnectedCipNetSample.cs" region="Usage8" title="结构体" />
		/// 定义好后，我们再来读取就很简单了。
		/// <code lang="cs" source="HslCommunication_Net45.Test\Documentation\Samples\Profinet\OmronConnectedCipNetSample.cs" region="Usage9" title="读写示例" />
		/// </example>
		/// <typeparam name="T">结构体的类型</typeparam>
		/// <param name="address">结构体对象的地址</param>
		/// <returns>是否读取成功的对象</returns>
		// Token: 0x0600072B RID: 1835 RVA: 0x00025D44 File Offset: 0x00023F44
		public OperateResult<T> ReadStruct<T>(string address) where T : struct
		{
			OperateResult<byte[]> operateResult = this.Read(address, 1);
			bool flag = !operateResult.IsSuccess;
			OperateResult<T> result;
			if (flag)
			{
				result = OperateResult.CreateFailedResult<T>(operateResult);
			}
			else
			{
				result = HslHelper.ByteArrayToStruct<T>(operateResult.Content.RemoveBegin(2));
			}
			return result;
		}

		// Token: 0x0600072C RID: 1836 RVA: 0x00025D88 File Offset: 0x00023F88
		[DebuggerStepThrough]
		private Task<OperateResult<byte[], ushort, bool>> ReadWithTypeAsync(string[] address, ushort[] length)
		{
			OmronConnectedCipNet.<ReadWithTypeAsync>d__24 <ReadWithTypeAsync>d__ = new OmronConnectedCipNet.<ReadWithTypeAsync>d__24();
			<ReadWithTypeAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<byte[], ushort, bool>>.Create();
			<ReadWithTypeAsync>d__.<>4__this = this;
			<ReadWithTypeAsync>d__.address = address;
			<ReadWithTypeAsync>d__.length = length;
			<ReadWithTypeAsync>d__.<>1__state = -1;
			<ReadWithTypeAsync>d__.<>t__builder.Start<OmronConnectedCipNet.<ReadWithTypeAsync>d__24>(ref <ReadWithTypeAsync>d__);
			return <ReadWithTypeAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Omron.OmronConnectedCipNet.ReadCipFromServer(System.Byte[][])" />
		// Token: 0x0600072D RID: 1837 RVA: 0x00025DDC File Offset: 0x00023FDC
		[DebuggerStepThrough]
		public Task<OperateResult<byte[]>> ReadCipFromServerAsync(params byte[][] cips)
		{
			OmronConnectedCipNet.<ReadCipFromServerAsync>d__25 <ReadCipFromServerAsync>d__ = new OmronConnectedCipNet.<ReadCipFromServerAsync>d__25();
			<ReadCipFromServerAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<byte[]>>.Create();
			<ReadCipFromServerAsync>d__.<>4__this = this;
			<ReadCipFromServerAsync>d__.cips = cips;
			<ReadCipFromServerAsync>d__.<>1__state = -1;
			<ReadCipFromServerAsync>d__.<>t__builder.Start<OmronConnectedCipNet.<ReadCipFromServerAsync>d__25>(ref <ReadCipFromServerAsync>d__);
			return <ReadCipFromServerAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Omron.OmronConnectedCipNet.ReadStruct``1(System.String)" />
		// Token: 0x0600072E RID: 1838 RVA: 0x00025E28 File Offset: 0x00024028
		[DebuggerStepThrough]
		public Task<OperateResult<T>> ReadStructAsync<T>(string address) where T : struct
		{
			OmronConnectedCipNet.<ReadStructAsync>d__26<T> <ReadStructAsync>d__ = new OmronConnectedCipNet.<ReadStructAsync>d__26<T>();
			<ReadStructAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<T>>.Create();
			<ReadStructAsync>d__.<>4__this = this;
			<ReadStructAsync>d__.address = address;
			<ReadStructAsync>d__.<>1__state = -1;
			<ReadStructAsync>d__.<>t__builder.Start<OmronConnectedCipNet.<ReadStructAsync>d__26<T>>(ref <ReadStructAsync>d__);
			return <ReadStructAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc />
		// Token: 0x0600072F RID: 1839 RVA: 0x00025E74 File Offset: 0x00024074
		[HslMqttApi("ReadByteArray", "")]
		public override OperateResult<byte[]> Read(string address, ushort length)
		{
			OperateResult<byte[], ushort, bool> operateResult = this.ReadWithType(new string[]
			{
				address
			}, new ushort[]
			{
				length
			});
			bool flag = !operateResult.IsSuccess;
			OperateResult<byte[]> result;
			if (flag)
			{
				result = OperateResult.CreateFailedResult<byte[]>(operateResult);
			}
			else
			{
				result = OperateResult.CreateSuccessResult<byte[]>(operateResult.Content1);
			}
			return result;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.AllenBradley.AllenBradleyNet.Read(System.String[],System.Int32[])" />
		// Token: 0x06000730 RID: 1840 RVA: 0x00025EC4 File Offset: 0x000240C4
		[HslMqttApi("ReadMultiAddress", "")]
		public OperateResult<byte[]> Read(string[] address, ushort[] length)
		{
			bool flag = !Authorization.asdniasnfaksndiqwhawfskhfaiw();
			OperateResult<byte[]> result;
			if (flag)
			{
				result = new OperateResult<byte[]>(StringResources.Language.InsufficientPrivileges);
			}
			else
			{
				OperateResult<byte[], ushort, bool> operateResult = this.ReadWithType(address, length);
				bool flag2 = !operateResult.IsSuccess;
				if (flag2)
				{
					result = OperateResult.CreateFailedResult<byte[]>(operateResult);
				}
				else
				{
					result = OperateResult.CreateSuccessResult<byte[]>(operateResult.Content1);
				}
			}
			return result;
		}

		/// <summary>
		/// 读取bool数据信息，如果读取的是单bool变量，就直接写变量名，如果是 bool 数组，就 <br />
		/// Read a single bool data information, if it is a single bool variable, write the variable name directly, 
		/// if it is a value of a bool array composed of int, it is always accessed with "i=" at the beginning, for example, "i=A[0]"
		/// </summary>
		/// <param name="address">节点的名称 -&gt; Name of the node </param>
		/// <param name="length">读取的数组长度信息</param>
		/// <returns>带有结果对象的结果数据 -&gt; Result data with result info </returns>
		// Token: 0x06000731 RID: 1841 RVA: 0x00025F20 File Offset: 0x00024120
		[HslMqttApi("ReadBoolArray", "")]
		public override OperateResult<bool[]> ReadBool(string address, ushort length)
		{
			bool flag = length == 1 && !Regex.IsMatch(address, "\\[[0-9]+\\]$");
			OperateResult<bool[]> result;
			if (flag)
			{
				OperateResult<byte[]> operateResult = this.Read(address, length);
				bool flag2 = !operateResult.IsSuccess;
				if (flag2)
				{
					result = OperateResult.CreateFailedResult<bool[]>(operateResult);
				}
				else
				{
					result = OperateResult.CreateSuccessResult<bool[]>(SoftBasic.ByteToBoolArray(operateResult.Content));
				}
			}
			else
			{
				OperateResult<byte[]> operateResult2 = this.Read(address, length);
				bool flag3 = !operateResult2.IsSuccess;
				if (flag3)
				{
					result = OperateResult.CreateFailedResult<bool[]>(operateResult2);
				}
				else
				{
					result = OperateResult.CreateSuccessResult<bool[]>(Enumerable.ToArray<bool>(Enumerable.Take<bool>(Enumerable.Select<byte, bool>(operateResult2.Content, (byte m) => m > 0), (int)length)));
				}
			}
			return result;
		}

		/// <summary>
		/// 读取PLC的byte类型的数据<br />
		/// Read the byte type of PLC data
		/// </summary>
		/// <param name="address">节点的名称 -&gt; Name of the node </param>
		/// <returns>带有结果对象的结果数据 -&gt; Result data with result info </returns>
		// Token: 0x06000732 RID: 1842 RVA: 0x0001BA1E File Offset: 0x00019C1E
		[HslMqttApi("ReadByte", "")]
		public OperateResult<byte> ReadByte(string address)
		{
			return ByteTransformHelper.GetResultFromArray<byte>(this.Read(address, 1));
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Omron.OmronConnectedCipNet.ReadBool(System.String,System.UInt16)" />
		// Token: 0x06000733 RID: 1843 RVA: 0x00025FE0 File Offset: 0x000241E0
		[DebuggerStepThrough]
		public override Task<OperateResult<bool[]>> ReadBoolAsync(string address, ushort length)
		{
			OmronConnectedCipNet.<ReadBoolAsync>d__31 <ReadBoolAsync>d__ = new OmronConnectedCipNet.<ReadBoolAsync>d__31();
			<ReadBoolAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<bool[]>>.Create();
			<ReadBoolAsync>d__.<>4__this = this;
			<ReadBoolAsync>d__.address = address;
			<ReadBoolAsync>d__.length = length;
			<ReadBoolAsync>d__.<>1__state = -1;
			<ReadBoolAsync>d__.<>t__builder.Start<OmronConnectedCipNet.<ReadBoolAsync>d__31>(ref <ReadBoolAsync>d__);
			return <ReadBoolAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc />
		// Token: 0x06000734 RID: 1844 RVA: 0x00026034 File Offset: 0x00024234
		[DebuggerStepThrough]
		public override Task<OperateResult<byte[]>> ReadAsync(string address, ushort length)
		{
			OmronConnectedCipNet.<ReadAsync>d__32 <ReadAsync>d__ = new OmronConnectedCipNet.<ReadAsync>d__32();
			<ReadAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<byte[]>>.Create();
			<ReadAsync>d__.<>4__this = this;
			<ReadAsync>d__.address = address;
			<ReadAsync>d__.length = length;
			<ReadAsync>d__.<>1__state = -1;
			<ReadAsync>d__.<>t__builder.Start<OmronConnectedCipNet.<ReadAsync>d__32>(ref <ReadAsync>d__);
			return <ReadAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Omron.OmronConnectedCipNet.Read(System.String[],System.UInt16[])" />
		// Token: 0x06000735 RID: 1845 RVA: 0x00026088 File Offset: 0x00024288
		[DebuggerStepThrough]
		public Task<OperateResult<byte[]>> ReadAsync(string[] address, ushort[] length)
		{
			OmronConnectedCipNet.<ReadAsync>d__33 <ReadAsync>d__ = new OmronConnectedCipNet.<ReadAsync>d__33();
			<ReadAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<byte[]>>.Create();
			<ReadAsync>d__.<>4__this = this;
			<ReadAsync>d__.address = address;
			<ReadAsync>d__.length = length;
			<ReadAsync>d__.<>1__state = -1;
			<ReadAsync>d__.<>t__builder.Start<OmronConnectedCipNet.<ReadAsync>d__33>(ref <ReadAsync>d__);
			return <ReadAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Omron.OmronConnectedCipNet.ReadByte(System.String)" />
		// Token: 0x06000736 RID: 1846 RVA: 0x000260DC File Offset: 0x000242DC
		[DebuggerStepThrough]
		public Task<OperateResult<byte>> ReadByteAsync(string address)
		{
			OmronConnectedCipNet.<ReadByteAsync>d__34 <ReadByteAsync>d__ = new OmronConnectedCipNet.<ReadByteAsync>d__34();
			<ReadByteAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<byte>>.Create();
			<ReadByteAsync>d__.<>4__this = this;
			<ReadByteAsync>d__.address = address;
			<ReadByteAsync>d__.<>1__state = -1;
			<ReadByteAsync>d__.<>t__builder.Start<OmronConnectedCipNet.<ReadByteAsync>d__34>(ref <ReadByteAsync>d__);
			return <ReadByteAsync>d__.<>t__builder.Task;
		}

		/// <summary>
		/// 当前的PLC不支持该功能，需要调用 <see cref="M:HslCommunication.Profinet.Omron.OmronConnectedCipNet.WriteTag(System.String,System.UInt16,System.Byte[],System.Int32)" /> 方法来实现。<br />
		/// The current PLC does not support this function, you need to call the <see cref="M:HslCommunication.Profinet.Omron.OmronConnectedCipNet.WriteTag(System.String,System.UInt16,System.Byte[],System.Int32)" /> method to achieve it.
		/// </summary>
		/// <param name="address">地址</param>
		/// <param name="value">值</param>
		/// <returns>写入结果值</returns>
		// Token: 0x06000737 RID: 1847 RVA: 0x00026127 File Offset: 0x00024327
		[HslMqttApi("WriteByteArray", "")]
		public override OperateResult Write(string address, byte[] value)
		{
			return new OperateResult(StringResources.Language.NotSupportedFunction + " Please refer to use WriteTag instead ");
		}

		/// <summary>
		/// 使用指定的类型写入指定的节点数据<br />
		/// Writes the specified node data with the specified type
		/// </summary>
		/// <param name="address">节点的名称 -&gt; Name of the node </param>
		/// <param name="typeCode">类型代码，详细参见<see cref="T:HslCommunication.Profinet.AllenBradley.AllenBradleyHelper" />上的常用字段 -&gt;  Type code, see the commonly used Fields section on the <see cref="T:HslCommunication.Profinet.AllenBradley.AllenBradleyHelper" /> in detail</param>
		/// <param name="value">实际的数据值 -&gt; The actual data value </param>
		/// <param name="length">如果节点是数组，就是数组长度 -&gt; If the node is an array, it is the array length </param>
		/// <returns>是否写入成功 -&gt; Whether to write successfully</returns>
		// Token: 0x06000738 RID: 1848 RVA: 0x00026144 File Offset: 0x00024344
		public virtual OperateResult WriteTag(string address, ushort typeCode, byte[] value, int length = 1)
		{
			OperateResult<byte[]> operateResult = this.BuildWriteCommand(address, typeCode, value, length);
			bool flag = !operateResult.IsSuccess;
			OperateResult result;
			if (flag)
			{
				result = operateResult;
			}
			else
			{
				OperateResult<byte[]> operateResult2 = base.ReadFromCoreServer(operateResult.Content);
				bool flag2 = !operateResult2.IsSuccess;
				if (flag2)
				{
					result = operateResult2;
				}
				else
				{
					OperateResult operateResult3 = AllenBradleyHelper.CheckResponse(operateResult2.Content);
					bool flag3 = !operateResult3.IsSuccess;
					if (flag3)
					{
						result = OperateResult.CreateFailedResult<byte[]>(operateResult3);
					}
					else
					{
						result = AllenBradleyHelper.ExtractActualData(operateResult2.Content, false);
					}
				}
			}
			return result;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Omron.OmronConnectedCipNet.Write(System.String,System.Byte[])" />
		// Token: 0x06000739 RID: 1849 RVA: 0x000261C8 File Offset: 0x000243C8
		[DebuggerStepThrough]
		public override Task<OperateResult> WriteAsync(string address, byte[] value)
		{
			OmronConnectedCipNet.<WriteAsync>d__37 <WriteAsync>d__ = new OmronConnectedCipNet.<WriteAsync>d__37();
			<WriteAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteAsync>d__.<>4__this = this;
			<WriteAsync>d__.address = address;
			<WriteAsync>d__.value = value;
			<WriteAsync>d__.<>1__state = -1;
			<WriteAsync>d__.<>t__builder.Start<OmronConnectedCipNet.<WriteAsync>d__37>(ref <WriteAsync>d__);
			return <WriteAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Omron.OmronConnectedCipNet.WriteTag(System.String,System.UInt16,System.Byte[],System.Int32)" />
		// Token: 0x0600073A RID: 1850 RVA: 0x0002621C File Offset: 0x0002441C
		[DebuggerStepThrough]
		public virtual Task<OperateResult> WriteTagAsync(string address, ushort typeCode, byte[] value, int length = 1)
		{
			OmronConnectedCipNet.<WriteTagAsync>d__38 <WriteTagAsync>d__ = new OmronConnectedCipNet.<WriteTagAsync>d__38();
			<WriteTagAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteTagAsync>d__.<>4__this = this;
			<WriteTagAsync>d__.address = address;
			<WriteTagAsync>d__.typeCode = typeCode;
			<WriteTagAsync>d__.value = value;
			<WriteTagAsync>d__.length = length;
			<WriteTagAsync>d__.<>1__state = -1;
			<WriteTagAsync>d__.<>t__builder.Start<OmronConnectedCipNet.<WriteTagAsync>d__38>(ref <WriteTagAsync>d__);
			return <WriteTagAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc />
		// Token: 0x0600073B RID: 1851 RVA: 0x00026280 File Offset: 0x00024480
		[HslMqttApi("ReadInt16Array", "")]
		public override OperateResult<short[]> ReadInt16(string address, ushort length)
		{
			return ByteTransformHelper.GetResultFromBytes<short[]>(this.Read(address, length), (byte[] m) => this.ByteTransform.TransInt16(m, 0, (int)length));
		}

		/// <inheritdoc />
		// Token: 0x0600073C RID: 1852 RVA: 0x000262C0 File Offset: 0x000244C0
		[HslMqttApi("ReadUInt16Array", "")]
		public override OperateResult<ushort[]> ReadUInt16(string address, ushort length)
		{
			return ByteTransformHelper.GetResultFromBytes<ushort[]>(this.Read(address, length), (byte[] m) => this.ByteTransform.TransUInt16(m, 0, (int)length));
		}

		/// <inheritdoc />
		// Token: 0x0600073D RID: 1853 RVA: 0x00026300 File Offset: 0x00024500
		[HslMqttApi("ReadInt32Array", "")]
		public override OperateResult<int[]> ReadInt32(string address, ushort length)
		{
			return ByteTransformHelper.GetResultFromBytes<int[]>(this.Read(address, length), (byte[] m) => this.ByteTransform.TransInt32(m, 0, (int)length));
		}

		/// <inheritdoc />
		// Token: 0x0600073E RID: 1854 RVA: 0x00026340 File Offset: 0x00024540
		[HslMqttApi("ReadUInt32Array", "")]
		public override OperateResult<uint[]> ReadUInt32(string address, ushort length)
		{
			return ByteTransformHelper.GetResultFromBytes<uint[]>(this.Read(address, length), (byte[] m) => this.ByteTransform.TransUInt32(m, 0, (int)length));
		}

		/// <inheritdoc />
		// Token: 0x0600073F RID: 1855 RVA: 0x00026380 File Offset: 0x00024580
		[HslMqttApi("ReadFloatArray", "")]
		public override OperateResult<float[]> ReadFloat(string address, ushort length)
		{
			return ByteTransformHelper.GetResultFromBytes<float[]>(this.Read(address, length), (byte[] m) => this.ByteTransform.TransSingle(m, 0, (int)length));
		}

		/// <inheritdoc />
		// Token: 0x06000740 RID: 1856 RVA: 0x000263C0 File Offset: 0x000245C0
		[HslMqttApi("ReadInt64Array", "")]
		public override OperateResult<long[]> ReadInt64(string address, ushort length)
		{
			return ByteTransformHelper.GetResultFromBytes<long[]>(this.Read(address, length), (byte[] m) => this.ByteTransform.TransInt64(m, 0, (int)length));
		}

		/// <inheritdoc />
		// Token: 0x06000741 RID: 1857 RVA: 0x00026400 File Offset: 0x00024600
		[HslMqttApi("ReadUInt64Array", "")]
		public override OperateResult<ulong[]> ReadUInt64(string address, ushort length)
		{
			return ByteTransformHelper.GetResultFromBytes<ulong[]>(this.Read(address, length), (byte[] m) => this.ByteTransform.TransUInt64(m, 0, (int)length));
		}

		/// <inheritdoc />
		// Token: 0x06000742 RID: 1858 RVA: 0x00026440 File Offset: 0x00024640
		[HslMqttApi("ReadDoubleArray", "")]
		public override OperateResult<double[]> ReadDouble(string address, ushort length)
		{
			return ByteTransformHelper.GetResultFromBytes<double[]>(this.Read(address, length), (byte[] m) => this.ByteTransform.TransDouble(m, 0, (int)length));
		}

		/// <inheritdoc />
		// Token: 0x06000743 RID: 1859 RVA: 0x0002647F File Offset: 0x0002467F
		public OperateResult<string> ReadString(string address)
		{
			return this.ReadString(address, 1, Encoding.UTF8);
		}

		/// <summary>
		/// 读取字符串数据，默认为UTF-8编码<br />
		/// Read string data, default is UTF-8 encoding
		/// </summary>
		/// <param name="address">起始地址</param>
		/// <param name="length">数据长度</param>
		/// <returns>带有成功标识的string数据</returns>
		/// <example>
		/// 以下为三菱的连接对象示例，其他的设备读写情况参照下面的代码：
		/// <code lang="cs" source="HslCommunication_Net45.Test\Documentation\Samples\Core\NetworkDeviceBase.cs" region="ReadString" title="String类型示例" />
		/// </example>
		// Token: 0x06000744 RID: 1860 RVA: 0x0002648E File Offset: 0x0002468E
		[HslMqttApi("ReadString", "")]
		public override OperateResult<string> ReadString(string address, ushort length)
		{
			return this.ReadString(address, length, Encoding.UTF8);
		}

		/// <inheritdoc />
		// Token: 0x06000745 RID: 1861 RVA: 0x000264A0 File Offset: 0x000246A0
		public override OperateResult<string> ReadString(string address, ushort length, Encoding encoding)
		{
			OperateResult<byte[]> operateResult = this.Read(address, length);
			bool flag = !operateResult.IsSuccess;
			OperateResult<string> result;
			if (flag)
			{
				result = OperateResult.CreateFailedResult<string>(operateResult);
			}
			else
			{
				bool flag2 = operateResult.Content.Length >= 2;
				if (flag2)
				{
					int count = (int)base.ByteTransform.TransUInt16(operateResult.Content, 0);
					result = OperateResult.CreateSuccessResult<string>(encoding.GetString(operateResult.Content, 2, count));
				}
				else
				{
					result = OperateResult.CreateSuccessResult<string>(encoding.GetString(operateResult.Content));
				}
			}
			return result;
		}

		/// <inheritdoc />
		// Token: 0x06000746 RID: 1862 RVA: 0x00026524 File Offset: 0x00024724
		[DebuggerStepThrough]
		public override Task<OperateResult<short[]>> ReadInt16Async(string address, ushort length)
		{
			OmronConnectedCipNet.<ReadInt16Async>d__50 <ReadInt16Async>d__ = new OmronConnectedCipNet.<ReadInt16Async>d__50();
			<ReadInt16Async>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<short[]>>.Create();
			<ReadInt16Async>d__.<>4__this = this;
			<ReadInt16Async>d__.address = address;
			<ReadInt16Async>d__.length = length;
			<ReadInt16Async>d__.<>1__state = -1;
			<ReadInt16Async>d__.<>t__builder.Start<OmronConnectedCipNet.<ReadInt16Async>d__50>(ref <ReadInt16Async>d__);
			return <ReadInt16Async>d__.<>t__builder.Task;
		}

		/// <inheritdoc />
		// Token: 0x06000747 RID: 1863 RVA: 0x00026578 File Offset: 0x00024778
		[DebuggerStepThrough]
		public override Task<OperateResult<ushort[]>> ReadUInt16Async(string address, ushort length)
		{
			OmronConnectedCipNet.<ReadUInt16Async>d__51 <ReadUInt16Async>d__ = new OmronConnectedCipNet.<ReadUInt16Async>d__51();
			<ReadUInt16Async>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<ushort[]>>.Create();
			<ReadUInt16Async>d__.<>4__this = this;
			<ReadUInt16Async>d__.address = address;
			<ReadUInt16Async>d__.length = length;
			<ReadUInt16Async>d__.<>1__state = -1;
			<ReadUInt16Async>d__.<>t__builder.Start<OmronConnectedCipNet.<ReadUInt16Async>d__51>(ref <ReadUInt16Async>d__);
			return <ReadUInt16Async>d__.<>t__builder.Task;
		}

		/// <inheritdoc />
		// Token: 0x06000748 RID: 1864 RVA: 0x000265CC File Offset: 0x000247CC
		[DebuggerStepThrough]
		public override Task<OperateResult<int[]>> ReadInt32Async(string address, ushort length)
		{
			OmronConnectedCipNet.<ReadInt32Async>d__52 <ReadInt32Async>d__ = new OmronConnectedCipNet.<ReadInt32Async>d__52();
			<ReadInt32Async>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<int[]>>.Create();
			<ReadInt32Async>d__.<>4__this = this;
			<ReadInt32Async>d__.address = address;
			<ReadInt32Async>d__.length = length;
			<ReadInt32Async>d__.<>1__state = -1;
			<ReadInt32Async>d__.<>t__builder.Start<OmronConnectedCipNet.<ReadInt32Async>d__52>(ref <ReadInt32Async>d__);
			return <ReadInt32Async>d__.<>t__builder.Task;
		}

		/// <inheritdoc />
		// Token: 0x06000749 RID: 1865 RVA: 0x00026620 File Offset: 0x00024820
		[DebuggerStepThrough]
		public override Task<OperateResult<uint[]>> ReadUInt32Async(string address, ushort length)
		{
			OmronConnectedCipNet.<ReadUInt32Async>d__53 <ReadUInt32Async>d__ = new OmronConnectedCipNet.<ReadUInt32Async>d__53();
			<ReadUInt32Async>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<uint[]>>.Create();
			<ReadUInt32Async>d__.<>4__this = this;
			<ReadUInt32Async>d__.address = address;
			<ReadUInt32Async>d__.length = length;
			<ReadUInt32Async>d__.<>1__state = -1;
			<ReadUInt32Async>d__.<>t__builder.Start<OmronConnectedCipNet.<ReadUInt32Async>d__53>(ref <ReadUInt32Async>d__);
			return <ReadUInt32Async>d__.<>t__builder.Task;
		}

		/// <inheritdoc />
		// Token: 0x0600074A RID: 1866 RVA: 0x00026674 File Offset: 0x00024874
		[DebuggerStepThrough]
		public override Task<OperateResult<float[]>> ReadFloatAsync(string address, ushort length)
		{
			OmronConnectedCipNet.<ReadFloatAsync>d__54 <ReadFloatAsync>d__ = new OmronConnectedCipNet.<ReadFloatAsync>d__54();
			<ReadFloatAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<float[]>>.Create();
			<ReadFloatAsync>d__.<>4__this = this;
			<ReadFloatAsync>d__.address = address;
			<ReadFloatAsync>d__.length = length;
			<ReadFloatAsync>d__.<>1__state = -1;
			<ReadFloatAsync>d__.<>t__builder.Start<OmronConnectedCipNet.<ReadFloatAsync>d__54>(ref <ReadFloatAsync>d__);
			return <ReadFloatAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc />
		// Token: 0x0600074B RID: 1867 RVA: 0x000266C8 File Offset: 0x000248C8
		[DebuggerStepThrough]
		public override Task<OperateResult<long[]>> ReadInt64Async(string address, ushort length)
		{
			OmronConnectedCipNet.<ReadInt64Async>d__55 <ReadInt64Async>d__ = new OmronConnectedCipNet.<ReadInt64Async>d__55();
			<ReadInt64Async>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<long[]>>.Create();
			<ReadInt64Async>d__.<>4__this = this;
			<ReadInt64Async>d__.address = address;
			<ReadInt64Async>d__.length = length;
			<ReadInt64Async>d__.<>1__state = -1;
			<ReadInt64Async>d__.<>t__builder.Start<OmronConnectedCipNet.<ReadInt64Async>d__55>(ref <ReadInt64Async>d__);
			return <ReadInt64Async>d__.<>t__builder.Task;
		}

		/// <inheritdoc />
		// Token: 0x0600074C RID: 1868 RVA: 0x0002671C File Offset: 0x0002491C
		[DebuggerStepThrough]
		public override Task<OperateResult<ulong[]>> ReadUInt64Async(string address, ushort length)
		{
			OmronConnectedCipNet.<ReadUInt64Async>d__56 <ReadUInt64Async>d__ = new OmronConnectedCipNet.<ReadUInt64Async>d__56();
			<ReadUInt64Async>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<ulong[]>>.Create();
			<ReadUInt64Async>d__.<>4__this = this;
			<ReadUInt64Async>d__.address = address;
			<ReadUInt64Async>d__.length = length;
			<ReadUInt64Async>d__.<>1__state = -1;
			<ReadUInt64Async>d__.<>t__builder.Start<OmronConnectedCipNet.<ReadUInt64Async>d__56>(ref <ReadUInt64Async>d__);
			return <ReadUInt64Async>d__.<>t__builder.Task;
		}

		/// <inheritdoc />
		// Token: 0x0600074D RID: 1869 RVA: 0x00026770 File Offset: 0x00024970
		[DebuggerStepThrough]
		public override Task<OperateResult<double[]>> ReadDoubleAsync(string address, ushort length)
		{
			OmronConnectedCipNet.<ReadDoubleAsync>d__57 <ReadDoubleAsync>d__ = new OmronConnectedCipNet.<ReadDoubleAsync>d__57();
			<ReadDoubleAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<double[]>>.Create();
			<ReadDoubleAsync>d__.<>4__this = this;
			<ReadDoubleAsync>d__.address = address;
			<ReadDoubleAsync>d__.length = length;
			<ReadDoubleAsync>d__.<>1__state = -1;
			<ReadDoubleAsync>d__.<>t__builder.Start<OmronConnectedCipNet.<ReadDoubleAsync>d__57>(ref <ReadDoubleAsync>d__);
			return <ReadDoubleAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc />
		// Token: 0x0600074E RID: 1870 RVA: 0x000267C4 File Offset: 0x000249C4
		[DebuggerStepThrough]
		public Task<OperateResult<string>> ReadStringAsync(string address)
		{
			OmronConnectedCipNet.<ReadStringAsync>d__58 <ReadStringAsync>d__ = new OmronConnectedCipNet.<ReadStringAsync>d__58();
			<ReadStringAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<string>>.Create();
			<ReadStringAsync>d__.<>4__this = this;
			<ReadStringAsync>d__.address = address;
			<ReadStringAsync>d__.<>1__state = -1;
			<ReadStringAsync>d__.<>t__builder.Start<OmronConnectedCipNet.<ReadStringAsync>d__58>(ref <ReadStringAsync>d__);
			return <ReadStringAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Omron.OmronConnectedCipNet.ReadString(System.String,System.UInt16)" />
		// Token: 0x0600074F RID: 1871 RVA: 0x00026810 File Offset: 0x00024A10
		[DebuggerStepThrough]
		public override Task<OperateResult<string>> ReadStringAsync(string address, ushort length)
		{
			OmronConnectedCipNet.<ReadStringAsync>d__59 <ReadStringAsync>d__ = new OmronConnectedCipNet.<ReadStringAsync>d__59();
			<ReadStringAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<string>>.Create();
			<ReadStringAsync>d__.<>4__this = this;
			<ReadStringAsync>d__.address = address;
			<ReadStringAsync>d__.length = length;
			<ReadStringAsync>d__.<>1__state = -1;
			<ReadStringAsync>d__.<>t__builder.Start<OmronConnectedCipNet.<ReadStringAsync>d__59>(ref <ReadStringAsync>d__);
			return <ReadStringAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc />
		// Token: 0x06000750 RID: 1872 RVA: 0x00026864 File Offset: 0x00024A64
		[DebuggerStepThrough]
		public override Task<OperateResult<string>> ReadStringAsync(string address, ushort length, Encoding encoding)
		{
			OmronConnectedCipNet.<ReadStringAsync>d__60 <ReadStringAsync>d__ = new OmronConnectedCipNet.<ReadStringAsync>d__60();
			<ReadStringAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<string>>.Create();
			<ReadStringAsync>d__.<>4__this = this;
			<ReadStringAsync>d__.address = address;
			<ReadStringAsync>d__.length = length;
			<ReadStringAsync>d__.encoding = encoding;
			<ReadStringAsync>d__.<>1__state = -1;
			<ReadStringAsync>d__.<>t__builder.Start<OmronConnectedCipNet.<ReadStringAsync>d__60>(ref <ReadStringAsync>d__);
			return <ReadStringAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc />
		// Token: 0x06000751 RID: 1873 RVA: 0x000268BD File Offset: 0x00024ABD
		[HslMqttApi("WriteInt16Array", "")]
		public override OperateResult Write(string address, short[] values)
		{
			return this.WriteTag(address, 195, base.ByteTransform.TransByte(values), values.Length);
		}

		/// <inheritdoc />
		// Token: 0x06000752 RID: 1874 RVA: 0x000268DA File Offset: 0x00024ADA
		[HslMqttApi("WriteUInt16Array", "")]
		public override OperateResult Write(string address, ushort[] values)
		{
			return this.WriteTag(address, 199, base.ByteTransform.TransByte(values), values.Length);
		}

		/// <inheritdoc />
		// Token: 0x06000753 RID: 1875 RVA: 0x000268F7 File Offset: 0x00024AF7
		[HslMqttApi("WriteInt32Array", "")]
		public override OperateResult Write(string address, int[] values)
		{
			return this.WriteTag(address, 196, base.ByteTransform.TransByte(values), values.Length);
		}

		/// <inheritdoc />
		// Token: 0x06000754 RID: 1876 RVA: 0x00026914 File Offset: 0x00024B14
		[HslMqttApi("WriteUInt32Array", "")]
		public override OperateResult Write(string address, uint[] values)
		{
			return this.WriteTag(address, 200, base.ByteTransform.TransByte(values), values.Length);
		}

		/// <inheritdoc />
		// Token: 0x06000755 RID: 1877 RVA: 0x00026931 File Offset: 0x00024B31
		[HslMqttApi("WriteFloatArray", "")]
		public override OperateResult Write(string address, float[] values)
		{
			return this.WriteTag(address, 202, base.ByteTransform.TransByte(values), values.Length);
		}

		/// <inheritdoc />
		// Token: 0x06000756 RID: 1878 RVA: 0x0002694E File Offset: 0x00024B4E
		[HslMqttApi("WriteInt64Array", "")]
		public override OperateResult Write(string address, long[] values)
		{
			return this.WriteTag(address, 197, base.ByteTransform.TransByte(values), values.Length);
		}

		/// <inheritdoc />
		// Token: 0x06000757 RID: 1879 RVA: 0x0002696B File Offset: 0x00024B6B
		[HslMqttApi("WriteUInt64Array", "")]
		public override OperateResult Write(string address, ulong[] values)
		{
			return this.WriteTag(address, 201, base.ByteTransform.TransByte(values), values.Length);
		}

		/// <inheritdoc />
		// Token: 0x06000758 RID: 1880 RVA: 0x00026988 File Offset: 0x00024B88
		[HslMqttApi("WriteDoubleArray", "")]
		public override OperateResult Write(string address, double[] values)
		{
			return this.WriteTag(address, 203, base.ByteTransform.TransByte(values), values.Length);
		}

		/// <inheritdoc />
		// Token: 0x06000759 RID: 1881 RVA: 0x000269A8 File Offset: 0x00024BA8
		[HslMqttApi("WriteString", "")]
		public override OperateResult Write(string address, string value)
		{
			byte[] array = string.IsNullOrEmpty(value) ? new byte[0] : Encoding.UTF8.GetBytes(value);
			return this.WriteTag(address, 208, SoftBasic.SpliceArray<byte>(new byte[][]
			{
				BitConverter.GetBytes((ushort)array.Length),
				array
			}), 1);
		}

		/// <inheritdoc />
		// Token: 0x0600075A RID: 1882 RVA: 0x000269FE File Offset: 0x00024BFE
		[HslMqttApi("WriteBool", "")]
		public override OperateResult Write(string address, bool value)
		{
			ushort typeCode = 193;
			byte[] value2;
			if (!value)
			{
				value2 = new byte[2];
			}
			else
			{
				byte[] array = new byte[2];
				array[0] = byte.MaxValue;
				value2 = array;
				array[1] = byte.MaxValue;
			}
			return this.WriteTag(address, typeCode, value2, 1);
		}

		/// <inheritdoc />
		// Token: 0x0600075B RID: 1883 RVA: 0x00026A2E File Offset: 0x00024C2E
		[HslMqttApi("WriteByte", "")]
		public OperateResult Write(string address, byte value)
		{
			return this.WriteTag(address, 194, new byte[]
			{
				value
			}, 1);
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Omron.OmronConnectedCipNet.Write(System.String,System.Int16[])" />
		// Token: 0x0600075C RID: 1884 RVA: 0x00026A48 File Offset: 0x00024C48
		[DebuggerStepThrough]
		public override Task<OperateResult> WriteAsync(string address, short[] values)
		{
			OmronConnectedCipNet.<WriteAsync>d__72 <WriteAsync>d__ = new OmronConnectedCipNet.<WriteAsync>d__72();
			<WriteAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteAsync>d__.<>4__this = this;
			<WriteAsync>d__.address = address;
			<WriteAsync>d__.values = values;
			<WriteAsync>d__.<>1__state = -1;
			<WriteAsync>d__.<>t__builder.Start<OmronConnectedCipNet.<WriteAsync>d__72>(ref <WriteAsync>d__);
			return <WriteAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Omron.OmronConnectedCipNet.Write(System.String,System.UInt16[])" />
		// Token: 0x0600075D RID: 1885 RVA: 0x00026A9C File Offset: 0x00024C9C
		[DebuggerStepThrough]
		public override Task<OperateResult> WriteAsync(string address, ushort[] values)
		{
			OmronConnectedCipNet.<WriteAsync>d__73 <WriteAsync>d__ = new OmronConnectedCipNet.<WriteAsync>d__73();
			<WriteAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteAsync>d__.<>4__this = this;
			<WriteAsync>d__.address = address;
			<WriteAsync>d__.values = values;
			<WriteAsync>d__.<>1__state = -1;
			<WriteAsync>d__.<>t__builder.Start<OmronConnectedCipNet.<WriteAsync>d__73>(ref <WriteAsync>d__);
			return <WriteAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Omron.OmronConnectedCipNet.Write(System.String,System.Int32[])" />
		// Token: 0x0600075E RID: 1886 RVA: 0x00026AF0 File Offset: 0x00024CF0
		[DebuggerStepThrough]
		public override Task<OperateResult> WriteAsync(string address, int[] values)
		{
			OmronConnectedCipNet.<WriteAsync>d__74 <WriteAsync>d__ = new OmronConnectedCipNet.<WriteAsync>d__74();
			<WriteAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteAsync>d__.<>4__this = this;
			<WriteAsync>d__.address = address;
			<WriteAsync>d__.values = values;
			<WriteAsync>d__.<>1__state = -1;
			<WriteAsync>d__.<>t__builder.Start<OmronConnectedCipNet.<WriteAsync>d__74>(ref <WriteAsync>d__);
			return <WriteAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Omron.OmronConnectedCipNet.Write(System.String,System.UInt32[])" />
		// Token: 0x0600075F RID: 1887 RVA: 0x00026B44 File Offset: 0x00024D44
		[DebuggerStepThrough]
		public override Task<OperateResult> WriteAsync(string address, uint[] values)
		{
			OmronConnectedCipNet.<WriteAsync>d__75 <WriteAsync>d__ = new OmronConnectedCipNet.<WriteAsync>d__75();
			<WriteAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteAsync>d__.<>4__this = this;
			<WriteAsync>d__.address = address;
			<WriteAsync>d__.values = values;
			<WriteAsync>d__.<>1__state = -1;
			<WriteAsync>d__.<>t__builder.Start<OmronConnectedCipNet.<WriteAsync>d__75>(ref <WriteAsync>d__);
			return <WriteAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Omron.OmronConnectedCipNet.Write(System.String,System.Single[])" />
		// Token: 0x06000760 RID: 1888 RVA: 0x00026B98 File Offset: 0x00024D98
		[DebuggerStepThrough]
		public override Task<OperateResult> WriteAsync(string address, float[] values)
		{
			OmronConnectedCipNet.<WriteAsync>d__76 <WriteAsync>d__ = new OmronConnectedCipNet.<WriteAsync>d__76();
			<WriteAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteAsync>d__.<>4__this = this;
			<WriteAsync>d__.address = address;
			<WriteAsync>d__.values = values;
			<WriteAsync>d__.<>1__state = -1;
			<WriteAsync>d__.<>t__builder.Start<OmronConnectedCipNet.<WriteAsync>d__76>(ref <WriteAsync>d__);
			return <WriteAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Omron.OmronConnectedCipNet.Write(System.String,System.Int64[])" />
		// Token: 0x06000761 RID: 1889 RVA: 0x00026BEC File Offset: 0x00024DEC
		[DebuggerStepThrough]
		public override Task<OperateResult> WriteAsync(string address, long[] values)
		{
			OmronConnectedCipNet.<WriteAsync>d__77 <WriteAsync>d__ = new OmronConnectedCipNet.<WriteAsync>d__77();
			<WriteAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteAsync>d__.<>4__this = this;
			<WriteAsync>d__.address = address;
			<WriteAsync>d__.values = values;
			<WriteAsync>d__.<>1__state = -1;
			<WriteAsync>d__.<>t__builder.Start<OmronConnectedCipNet.<WriteAsync>d__77>(ref <WriteAsync>d__);
			return <WriteAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Omron.OmronConnectedCipNet.Write(System.String,System.UInt64[])" />
		// Token: 0x06000762 RID: 1890 RVA: 0x00026C40 File Offset: 0x00024E40
		[DebuggerStepThrough]
		public override Task<OperateResult> WriteAsync(string address, ulong[] values)
		{
			OmronConnectedCipNet.<WriteAsync>d__78 <WriteAsync>d__ = new OmronConnectedCipNet.<WriteAsync>d__78();
			<WriteAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteAsync>d__.<>4__this = this;
			<WriteAsync>d__.address = address;
			<WriteAsync>d__.values = values;
			<WriteAsync>d__.<>1__state = -1;
			<WriteAsync>d__.<>t__builder.Start<OmronConnectedCipNet.<WriteAsync>d__78>(ref <WriteAsync>d__);
			return <WriteAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Omron.OmronConnectedCipNet.Write(System.String,System.Double[])" />
		// Token: 0x06000763 RID: 1891 RVA: 0x00026C94 File Offset: 0x00024E94
		[DebuggerStepThrough]
		public override Task<OperateResult> WriteAsync(string address, double[] values)
		{
			OmronConnectedCipNet.<WriteAsync>d__79 <WriteAsync>d__ = new OmronConnectedCipNet.<WriteAsync>d__79();
			<WriteAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteAsync>d__.<>4__this = this;
			<WriteAsync>d__.address = address;
			<WriteAsync>d__.values = values;
			<WriteAsync>d__.<>1__state = -1;
			<WriteAsync>d__.<>t__builder.Start<OmronConnectedCipNet.<WriteAsync>d__79>(ref <WriteAsync>d__);
			return <WriteAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Omron.OmronConnectedCipNet.Write(System.String,System.String)" />
		// Token: 0x06000764 RID: 1892 RVA: 0x00026CE8 File Offset: 0x00024EE8
		[DebuggerStepThrough]
		public override Task<OperateResult> WriteAsync(string address, string value)
		{
			OmronConnectedCipNet.<WriteAsync>d__80 <WriteAsync>d__ = new OmronConnectedCipNet.<WriteAsync>d__80();
			<WriteAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteAsync>d__.<>4__this = this;
			<WriteAsync>d__.address = address;
			<WriteAsync>d__.value = value;
			<WriteAsync>d__.<>1__state = -1;
			<WriteAsync>d__.<>t__builder.Start<OmronConnectedCipNet.<WriteAsync>d__80>(ref <WriteAsync>d__);
			return <WriteAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Omron.OmronConnectedCipNet.Write(System.String,System.Boolean)" />
		// Token: 0x06000765 RID: 1893 RVA: 0x00026D3C File Offset: 0x00024F3C
		[DebuggerStepThrough]
		public override Task<OperateResult> WriteAsync(string address, bool value)
		{
			OmronConnectedCipNet.<WriteAsync>d__81 <WriteAsync>d__ = new OmronConnectedCipNet.<WriteAsync>d__81();
			<WriteAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteAsync>d__.<>4__this = this;
			<WriteAsync>d__.address = address;
			<WriteAsync>d__.value = value;
			<WriteAsync>d__.<>1__state = -1;
			<WriteAsync>d__.<>t__builder.Start<OmronConnectedCipNet.<WriteAsync>d__81>(ref <WriteAsync>d__);
			return <WriteAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.Profinet.Omron.OmronConnectedCipNet.Write(System.String,System.Byte)" />
		// Token: 0x06000766 RID: 1894 RVA: 0x00026D90 File Offset: 0x00024F90
		[DebuggerStepThrough]
		public Task<OperateResult> WriteAsync(string address, byte value)
		{
			OmronConnectedCipNet.<WriteAsync>d__82 <WriteAsync>d__ = new OmronConnectedCipNet.<WriteAsync>d__82();
			<WriteAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<WriteAsync>d__.<>4__this = this;
			<WriteAsync>d__.address = address;
			<WriteAsync>d__.value = value;
			<WriteAsync>d__.<>1__state = -1;
			<WriteAsync>d__.<>t__builder.Start<OmronConnectedCipNet.<WriteAsync>d__82>(ref <WriteAsync>d__);
			return <WriteAsync>d__.<>t__builder.Task;
		}

		// Token: 0x06000767 RID: 1895 RVA: 0x00026DE4 File Offset: 0x00024FE4
		private byte[] GetLargeForwardOpen()
		{
			return "00 00 00 00 00 00 02 00 00 00 00 00 b2 00 34 00\r\n5b 02 20 06 24 01 06 9c 02 00 00 80 01 00 fe 80\r\n02 00 1b 05 30 a7 2b 03 02 00 00 00 80 84 1e 00\r\ncc 07 00 42 80 84 1e 00 cc 07 00 42 a3 03 20 02\r\n24 01 2c 01".ToHexBytes();
		}

		// Token: 0x06000768 RID: 1896 RVA: 0x00026E04 File Offset: 0x00025004
		private byte[] GetAttributeAll()
		{
			return "00 00 00 00 00 00 02 00 00 00 00 00 b2 00 06 00 01 02 20 01 24 01".ToHexBytes();
		}

		/// <summary>
		/// 从PLC反馈的数据解析
		/// </summary>
		/// <param name="response">PLC的反馈数据</param>
		/// <param name="isRead">是否是返回的操作</param>
		/// <returns>带有结果标识的最终数据</returns>
		// Token: 0x06000769 RID: 1897 RVA: 0x00026E24 File Offset: 0x00025024
		public static OperateResult<byte[], ushort, bool> ExtractActualData(byte[] response, bool isRead)
		{
			List<byte> list = new List<byte>();
			int num = 42;
			bool value = false;
			ushort value2 = 0;
			ushort num2 = BitConverter.ToUInt16(response, num);
			bool flag = BitConverter.ToInt32(response, 46) == 138;
			if (!flag)
			{
				byte b = response[num + 6];
				byte b2 = b;
				byte b3 = b2;
				if (b3 <= 19)
				{
					switch (b3)
					{
					case 0:
						break;
					case 1:
					case 2:
					case 3:
						goto IL_448;
					case 4:
						return new OperateResult<byte[], ushort, bool>
						{
							ErrorCode = (int)b,
							Message = StringResources.Language.AllenBradley04
						};
					case 5:
						return new OperateResult<byte[], ushort, bool>
						{
							ErrorCode = (int)b,
							Message = StringResources.Language.AllenBradley05
						};
					case 6:
						value = true;
						break;
					default:
						if (b3 == 10)
						{
							return new OperateResult<byte[], ushort, bool>
							{
								ErrorCode = (int)b,
								Message = StringResources.Language.AllenBradley0A
							};
						}
						if (b3 != 19)
						{
							goto IL_448;
						}
						return new OperateResult<byte[], ushort, bool>
						{
							ErrorCode = (int)b,
							Message = StringResources.Language.AllenBradley13
						};
					}
					bool flag2 = response[num + 4] == 205 || response[num + 4] == 211;
					if (flag2)
					{
						return OperateResult.CreateSuccessResult<byte[], ushort, bool>(list.ToArray(), value2, value);
					}
					bool flag3 = response[num + 4] == 204 || response[num + 4] == 210;
					if (flag3)
					{
						for (int i = num + 10; i < num + 2 + (int)num2; i++)
						{
							list.Add(response[i]);
						}
						value2 = BitConverter.ToUInt16(response, num + 8);
					}
					else
					{
						bool flag4 = response[num + 4] == 213;
						if (flag4)
						{
							for (int j = num + 8; j < num + 2 + (int)num2; j++)
							{
								list.Add(response[j]);
							}
						}
					}
					goto IL_53C;
				}
				else
				{
					if (b3 == 28)
					{
						return new OperateResult<byte[], ushort, bool>
						{
							ErrorCode = (int)b,
							Message = StringResources.Language.AllenBradley1C
						};
					}
					if (b3 == 30)
					{
						return new OperateResult<byte[], ushort, bool>
						{
							ErrorCode = (int)b,
							Message = StringResources.Language.AllenBradley1E
						};
					}
					if (b3 == 38)
					{
						return new OperateResult<byte[], ushort, bool>
						{
							ErrorCode = (int)b,
							Message = StringResources.Language.AllenBradley26
						};
					}
				}
				IL_448:
				return new OperateResult<byte[], ushort, bool>
				{
					ErrorCode = (int)b,
					Message = StringResources.Language.UnknownError
				};
			}
			num = 50;
			int num3 = (int)BitConverter.ToUInt16(response, num);
			int k = 0;
			while (k < num3)
			{
				int num4 = (int)BitConverter.ToUInt16(response, num + 2 + k * 2) + num;
				int num5 = (k == num3 - 1) ? response.Length : ((int)BitConverter.ToUInt16(response, num + 4 + k * 2) + num);
				ushort num6 = BitConverter.ToUInt16(response, num4 + 2);
				ushort num7 = num6;
				ushort num8 = num7;
				if (num8 <= 19)
				{
					switch (num8)
					{
					case 0:
						break;
					case 1:
					case 2:
					case 3:
						goto IL_24B;
					case 4:
						return new OperateResult<byte[], ushort, bool>
						{
							ErrorCode = (int)num6,
							Message = StringResources.Language.AllenBradley04
						};
					case 5:
						return new OperateResult<byte[], ushort, bool>
						{
							ErrorCode = (int)num6,
							Message = StringResources.Language.AllenBradley05
						};
					case 6:
					{
						bool flag5 = response[num + 2] == 210 || response[num + 2] == 204;
						if (flag5)
						{
							return new OperateResult<byte[], ushort, bool>
							{
								ErrorCode = (int)num6,
								Message = StringResources.Language.AllenBradley06
							};
						}
						break;
					}
					default:
						if (num8 == 10)
						{
							return new OperateResult<byte[], ushort, bool>
							{
								ErrorCode = (int)num6,
								Message = StringResources.Language.AllenBradley0A
							};
						}
						if (num8 != 19)
						{
							goto IL_24B;
						}
						return new OperateResult<byte[], ushort, bool>
						{
							ErrorCode = (int)num6,
							Message = StringResources.Language.AllenBradley13
						};
					}
					if (isRead)
					{
						for (int l = num4 + 6; l < num5; l++)
						{
							list.Add(response[l]);
						}
					}
					k++;
					continue;
				}
				if (num8 == 28)
				{
					return new OperateResult<byte[], ushort, bool>
					{
						ErrorCode = (int)num6,
						Message = StringResources.Language.AllenBradley1C
					};
				}
				if (num8 == 30)
				{
					return new OperateResult<byte[], ushort, bool>
					{
						ErrorCode = (int)num6,
						Message = StringResources.Language.AllenBradley1E
					};
				}
				if (num8 == 38)
				{
					return new OperateResult<byte[], ushort, bool>
					{
						ErrorCode = (int)num6,
						Message = StringResources.Language.AllenBradley26
					};
				}
				IL_24B:
				return new OperateResult<byte[], ushort, bool>
				{
					ErrorCode = (int)num6,
					Message = StringResources.Language.UnknownError
				};
			}
			IL_53C:
			return OperateResult.CreateSuccessResult<byte[], ushort, bool>(list.ToArray(), value2, value);
		}

		/// <summary>
		/// O -&gt; T Network Connection ID
		/// </summary>
		// Token: 0x040001D1 RID: 465
		private uint OTConnectionId = 0U;

		// Token: 0x040001D2 RID: 466
		private SoftIncrementCount incrementCount = new SoftIncrementCount(65535L, 0L, 1);

		// Token: 0x040001D3 RID: 467
		private Random random = new Random();
	}
}
